local UI = SecretaryUI

local function CloseButton_OnClick (self)
	self:GetParent().object:OnCloseButtonClick()
end

local function CreateCloseButton(parent)
	local button = CreateFrame("Button", nil, parent)
	
	local CreateTexture = UI.CreateTexture
	button:SetNormalTexture(CreateTexture(button, "Interface\\Buttons\\UI-Panel-MinimizeButton-Up"))
	button:SetPushedTexture(CreateTexture(button, "Interface\\Buttons\\UI-Panel-MinimizeButton-Down"))
	button:SetHighlightTexture(CreateTexture(button, "Interface\\Buttons\\UI-Panel-MinimizeButton-Highlight", "ADD"))
	button:SetScript("OnClick", CloseButton_OnClick)
	
	button:SetWidth(32)
	button:SetHeight(32)
	button:ClearAllPoints()
	button:SetPoint("TOPRIGHT", 1, 0)
	
	return button
end

UI.CreateCloseButton = CreateCloseButton
